/**
 * 
 */
package eu.news.data.hibernate.dao;

import java.util.List;

import org.hibernate.Query;

import eu.news.data.dao.InterfaceDAO;
import eu.news.data.hibernate.pojo.HB_Interface;
import eu.news.data.pojo.Interface;


/**
 * @author WZZ
 *
 */
public class HB_InterfaceDAO extends HibernateBaseDAO<Interface> implements InterfaceDAO{

	protected HB_InterfaceDAO(){}
	
	public Interface getByKey(String id){
		String hql="from HB_Interface where id=:id";
		Query query=session.createQuery(hql);
		query.setString("id", id);
		return (Interface) query.uniqueResult();
	}
	
	@SuppressWarnings("unchecked")
	public List<Interface> getAll(int start, int size) {
		String hql="from HB_Interface";
		Query query=session.createQuery(hql);
		query.setFirstResult(start);
		query.setMaxResults(size);
		return query.list();
	}

	@Override
	public Interface newEntity() {
		return new HB_Interface();
	}
}
